package com.lsh.dao;

import com.lsh.entity.QueryPageBean;
import com.lsh.pojo.Setmeal;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface SetmealDao {
    void add(Setmeal setmeal);
    @Insert("insert into t_setmeal_checkgroup(setmeal_id,checkgroup_id) values(#{setmealId},#{checkgroupId})")
    void addSetmealCheckgroup(@Param("setmealId") Integer id, @Param("checkgroupId") Integer checkgroupId);

    List<Setmeal> findPage(QueryPageBean queryPageBean);
    @Select("select * from t_setmeal where id = #{id}")
    Setmeal findById(@Param("id") Integer id);
    @Select("select checkgroup_id from t_setmeal_checkgroup where setmeal_id = #{id}")
    List<Integer> findCheckgroupIdsBySetmealId(@Param("id") Integer id);
    @Update("update t_setmeal set name=#{name},code=#{code},helpCode=#{helpCode},sex=#{sex},age=#{age},price=#{price},remark=#{remark},attention=#{attention},img=#{img} where id = #{id}")
    void update(Setmeal setmeal);
    @Delete("delete from t_setmeal_checkgroup where setmeal_id = #{id}")
    void deleteCheckgroupIdsBySetmealId(@Param("id") Integer id);
    @Select("select count(1) from t_order where setmeal_id = #{id}")
    Long findOrderIdBySetmealId(@Param("id") Integer id);
    @Delete("delete from t_setmeal where id = #{id}")
    void deleteById(Integer id);
    @Select("select img from t_setmeal")
    List<String> findAllImgName();
}
